package gui.gui2d.menu.events;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JLabel;

public class MenuActionListener extends Observable implements MouseListener {


	@Override
	public void mouseClicked(MouseEvent e) {
		JLabel jl = (JLabel)e.getComponent();
		if(jl.getText().equals("Gioca sulla stessa scacchiera")){
			setChanged();
			notifyObservers("new");
		}else if(jl.getText().equals("Gioca contro il Pc")){
			setChanged();
			notifyObservers("ia");
			
		}else if(jl.getText().equals("Attendi giocatore dalla rete")){
			setChanged();
			notifyObservers("lan_server");
			
		}else if(jl.getText().equals("Cerca giocatore in rete")){
			setChanged();
			notifyObservers("lan_search");
			
		}else if(jl.getText().equals("Esci")){
			setChanged();
			notifyObservers("exit");
			
		}
		
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		JLabel jl = (JLabel)e.getComponent();
		jl.setOpaque(true);
		jl.setBackground(new Color(100,60,50,100));
		jl.getParent().getParent().getParent().repaint();
	}

	@Override
	public void mouseExited(MouseEvent e) {
		JLabel jl = (JLabel)e.getComponent();
		jl.setOpaque(false);
		jl.getParent().getParent().getParent().repaint();
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

}
